home *** CD-ROM | disk | FTP | other *** search
- property horseSprite, horseSprites, thingSprites, grassSprites, sprites, thingsOn, stopSprite, stopped, leftSideSprite, rightSideSprite, riverSprite, fenceSprite, whichHorse, speed, overAllSpeed, jumpTime, leftStop, rightStop, horseSideRect, dontTrig, backCounter, horsR, horsL, horsV, startTime, runTime, tiredHorse, backIsOK, randTrigNum, DirectTrig, dontTrigFor, JumpSprites, StopSprites, StopSymbolCounter, JumpSymbolCounter
-
- on new me
- overAllSpeed = 0
- horsR = 565
- horsL = 240
- horsV = 395
- StopSymbolCounter = 0
- JumpSymbolCounter = 0
- JumpSprites = []
- StopSprites = []
- return me
- end
-
- on initGame me
- backIsOK = 1
- tiredHorse = 0
- backCounter = 25
- overAllSpeed = overAllSpeed + 1
- speed = overAllSpeed
- startTime = the ticks
- thingsOn = []
- horseSprites = []
- thingSprites = []
- grassSprites = []
- randTrigNum = 0
- DirectTrig = 0
- dontTrigFor = 0
- stopped = 0
- dontTrig = 0
- end
-
- on checkOtherZeroJumpables me, pSprite
- v = 1
- if thingsOn.count > 0 then
- repeat with n = 1 to thingsOn.count
- if thingsOn[n].jumpable = 0 then
- if pSprite <> thingsOn[n] then
- v = 0
- exit repeat
- end if
- end if
- end repeat
- end if
- return v
- end
-
- on trigThings me
- if speed > 0 then
- runTime = the ticks - startTime
- if runTime > 4500 then
- if dontTrig = 1 then
- if thingsOn.count = 1 then
- dontTrig = 2
- setOn(thingsOn[1])
- end if
- exit
- else
- if dontTrig = 0 then
- dontTrig = 1
- if overAllSpeed = 1 then
- thingsOn[thingsOn.count + 1] = riverSprite
- else
- if overAllSpeed = 2 then
- thingsOn[thingsOn.count + 1] = fenceSprite
- end if
- end if
- exit
- else
- exit
- end if
- end if
- else
- if DirectTrig = randTrigNum then
- if dontTrigFor < 1 then
- randTrigNum = random(2)
- DirectTrig = random(randTrigNum)
- trig(me, 1, DirectTrig)
- else
- dontTrigFor = dontTrigFor - 1
- end if
- else
- trig(me, DirectTrig + 1, randTrigNum)
- DirectTrig = randTrigNum
- dontTrigFor = 1
- end if
- end if
- end if
- end
-
- on trig me, pNum1, pNum2
- repeat with n = pNum1 to pNum2
- numb = random(sprites.count)
- thingsOn[thingsOn.count + 1] = sprites[numb]
- sprites[numb].setOn(randTrigNum, n)
- sprites.deleteAt(numb)
- end repeat
- end
-
- on reCoverThing me, pSprite
- thingsOn.deleteOne(pSprite)
- sprites[sprites.count + 1] = pSprite
- end
-
- on deCoverThing me, pSprite
- thingsOn.deleteOne(pSprite)
- end
-
- on lookUpBack me, pLoc
- backLoc = pLoc + point(0, 120)
- repeat with n = 1 to thingsOn.count
- baseRect = thingsOn[n].rect
- if inside(backLoc, baseRect) or inside(backLoc + point(-20, 0), baseRect) then
- if thingsOn[n].loc[2] > backLoc[2] then
- thingsOn[n].locZup()
- next repeat
- end if
- stopped = 0
- changeHorse(me, 1)
- exit repeat
- end if
- end repeat
- checkSides(me, pLoc)
- end
-
- on checkSides me, pLoc
- if leftStop = 1 then
- horseSideRect = rect(pLoc[1] - 30, pLoc[2] - 50, pLoc[1] + 30, pLoc[2] + 70)
- if intersect(horseSideRect, rect(leftSideSprite.rect[1], leftSideSprite.loc[2], leftSideSprite.rect[3], leftSideSprite.rect[4])) > rect(0, 0, 0, 0) = 0 then
- leftStop = 0
- end if
- end if
- if rightStop = 1 then
- horseSideRect = rect(pLoc[1] - 30, pLoc[2] - 50, pLoc[1] + 30, pLoc[2] + 70)
- if intersect(horseSideRect, rect(rightSideSprite.rect[1], rightSideSprite.loc[2], rightSideSprite.rect[3], rightSideSprite.rect[4])) > rect(0, 0, 0, 0) = 0 then
- rightStop = 0
- end if
- end if
- end
-
- on lookup me, pLoc
- horseFrontRect = rect(pLoc[1] + 20, pLoc[2] - 65, pLoc[1] + 25, pLoc[2] - 60)
- horseSideRect = rect(pLoc[1] - 30, pLoc[2] - 50, pLoc[1] + 30, pLoc[2] + 70)
- backLoc = pLoc + point(0, 60)
- if thingsOn.count > 0 then
- repeat with n = 1 to thingsOn.count
- baseRect = thingsOn[n].rect
- if intersect(horseFrontRect, baseRect) > rect(0, 0, 0, 0) then
- if ((the frameLabel = "h2") and (thingsOn[n].jumpable = 0)) or (the frameLabel <> "h2") then
- if thingsOn[n].loc[2] > backLoc[2] then
- thingsOn[n].locZup()
- else
- thingsOn[n].locZdown()
- if speed > 0 then
- stopped = 1
- stopSprite = thingsOn[n]
- changeHorse(me, 4)
- exit repeat
- end if
- end if
- end if
- end if
- if the frameLabel <> "h2" then
- if intersect(horseSideRect, baseRect) > rect(0, 0, 0, 0) then
- if thingsOn[n].locH < pLoc[1] then
- if leftStop = 0 then
- if thingsOn[n].loc[2] > backLoc[2] then
- thingsOn[n].locZup()
- else
- thingsOn[n].locZdown()
- leftSideSprite = thingsOn[n]
- leftStop = 1
- end if
- end if
- next repeat
- end if
- if rightStop = 0 then
- if thingsOn[n].loc[2] > backLoc[2] then
- thingsOn[n].locZup()
- next repeat
- end if
- thingsOn[n].locZdown()
- rightSideSprite = thingsOn[n]
- rightStop = 1
- end if
- end if
- end if
- end repeat
- if stopped = 1 then
- if intersect(horseFrontRect, stopSprite.rect) < rect(1, 1, 1, 1) then
- stopped = 0
- changeHorse(me, 5)
- end if
- end if
- checkSides(me, pLoc)
- end if
- end
-
- on intersectTest me, pRect, pSprite
- repeat with n = 1 to thingsOn.count
- if intersect(thingsOn[n].rect + rect(0, -20, 0, 0), pRect) <> rect(0, 0, 0, 0) then
- if pSprite <> thingsOn[n] then
- return 1
- exit
- end if
- end if
- end repeat
- return 0
- end
-
- on intersectTestX me, pRect, pSprite
- repeat with n = 1 to thingsOn.count
- if intersect(thingsOn[n].rect + rect(0, -100, 0, 0), pRect) <> rect(0, 0, 0, 0) then
- if pSprite <> thingsOn[n] then
- return 1
- exit
- end if
- end if
- end repeat
- return 0
- end
-
- on intersectTestJump me, pRect, pSprite
- repeat with n = 1 to thingsOn.count
- if intersect(thingsOn[n].rect, pRect) <> rect(0, 0, 0, 0) then
- if pSprite <> thingsOn[n] then
- return 1
- exit
- end if
- end if
- end repeat
- return 0
- end
-
- on initSpriteList me
- sprites = []
- repeat with n = 1 to thingSprites.count
- sprites[n] = thingSprites[n]
- end repeat
- thingsOn = []
- end
-
- on setSpeedThings me
- if thingsOn.count > 0 then
- repeat with n = 1 to thingsOn.count
- thingsOn[n].setSpeed()
- end repeat
- repeat with n = 1 to grassSprites.count
- grassSprites[n].setSpeed()
- end repeat
- end if
- end
-
- on goBack me
- if the frameLabel <> "h6" then
- changeHorse(me, 6)
- end if
- end
-
- on changeHorse me, p
- case p of
- 1:
- speed = 1 * overAllSpeed
- setSpeedThings(me)
- 2:
- jumpTime = the ticks + (70 / overAllSpeed)
- 4:
- speed = 0
- setSpeedThings(me)
- 6:
- speed = -3
- setSpeedThings(me)
- end case
- whichHorse = p
- horsH = horseSprite.locH
- horseSprite = horseSprites[whichHorse]
- repeat with n = 1 to horseSprites.count
- horseSprites[n].locV = 1000
- horseSprites[n].static = 1
- end repeat
- horseSprite.locV = horsV
- horseSprite.locH = horsH
- horseSprite.static = 0
- go("h" & string(p))
- end
-
- on reportHorse me, pSprite
- horseSprites[horseSprites.count + 1] = sprite(pSprite)
- if horseSprite = VOID then
- horseSprite = horseSprites[1]
- end if
- end
-
- on reportThing me, pSprite
- thingSprites[thingSprites.count + 1] = sprite(pSprite)
- end
-
- on reportGrass me, pSprite
- grassSprites[grassSprites.count + 1] = sprite(pSprite)
- end
-
- on reportStopSprite me, pSprite
- StopSprites[StopSprites.count + 1] = pSprite
- end
-
- on reportJumpSprite me, pSprite
- JumpSprites[JumpSprites.count + 1] = pSprite
- end
-
- on makeStopSymbol me
- StopSymbolCounter = StopSymbolCounter + 1
- if StopSymbolCounter < 13 then
- spriteN = (StopSymbolCounter + 2) / 3
- StopSprites[spriteN].hitShoe()
- if StopSymbolCounter = 12 then
- tiredHorse = 1
- end if
- end if
- end
-
- on makeJumpSymbol me
- if JumpSymbolCounter < JumpSprites.count then
- JumpSymbolCounter = JumpSymbolCounter + 1
- JumpSprites[JumpSymbolCounter].sugar()
- end if
- end
-
- on mouseHX me, pM
- if (horseSprite.locH + pM) > horsR then
- horseSprite.loc = point(horsR, horsV)
- else
- if (horseSprite.locH + pM) < horsL then
- horseSprite.loc = point(horsL, horsV)
- else
- if (rightStop = 0) and (leftStop = 0) then
- horseSprite.loc = horseSprite.loc + point(pM, 0)
- else
- if rightStop = 1 then
- if pM < 0 then
- horseSprite.loc = horseSprite.loc + point(pM, 0)
- end if
- end if
- if leftStop = 1 then
- if pM > 0 then
- horseSprite.loc = horseSprite.loc + point(pM, 0)
- end if
- end if
- end if
- end if
- end if
- end
-
- on keyHit me
- if the frameLabel <> 0 then
- v = (the frameLabel).char[1]
- if v = "h" then
- case the keyCode of
- 49:
- if the frameLabel = "h1" then
- me.jump()
- end if
- 123:
- me.mouseHX(-20)
- 124:
- me.mouseHX(20)
- end case
- end if
- end if
- end
-
- on jump me
- changeHorse(me, 2)
- end
-
- on leftX me
- mouseHX(me, -40)
- end
-
- on rightX me
- mouseHX(me, 40)
- end
-